﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RootBaseFramework;

namespace TestRootBaseData.Service.Model
{
 public   class Person:RootEntityBase<int>
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }

       //public Person ParentEntity { get; set; }

       readonly List<Person> _children = new List<Person>();     
        
        public IList<Person> Children
        {
            get { return _children; }
        }

      
      
        //public override void TraceBloodLine(char delimeter = '`')
        //{
          
        //    string bloodline = "0";
        //    if(Parent!=null)
        //        bloodline =Parent.BloodLine;

        //    bloodline = bloodline + delimeter + this.EntityId.ToString();

        //    BloodLine = bloodline;
        //}



       

        //public override List<object> GetMyLines(object Repo,object UWork)
        //{
            
        //    if (UWork == null)
        //    { 
        //        var context = new Service.Repository.Database.RootBaseTestContext();
        //        UWork = new RootBaseFramework.Infra.Data.UnitOfWork(context);
        //    }

        //    var uWork = (RootBaseFramework.Infra.Data.UnitOfWork)UWork;

        //    if (Repo == null)
        //    {
        //        Repo = new Service.Repository.Database.PersonRepository(uWork);
        //    }

        //    base.SetRepository(Repo, UWork);

        //   var repo = (Service.Repository.Database.PersonRepository)Repo;
          
        //    var q = repo.FindAll();
        //   var q1 = q.Where(p => p.BloodLine.StartsWith(OldBloodLine));
        //   return q1.Cast<object>().ToList();
        //}
    }
}
